package com.cy.核心编程.thead.basic.yellow;

import java.util.concurrent.BlockingQueue;

/**
 * 消费者，发送视频
 */
public class SendVideoThread extends Thread {
    private BlockingQueue<Video> videoQueue;

    public SendVideoThread(BlockingQueue<Video> videoQueue) {
        this.videoQueue = videoQueue;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Video video = videoQueue.take();

                System.out.println("我是发送的地方，我发送了一个视频：" + video.getName());
                Thread.sleep(150);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
